﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="旬合同量管理.aspx.cs" Inherits="syc.Sale.旬合同量管理" %>

<head runat="server">
    <title></title>
</head>
<body>
      <script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">旬合同量管理</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <asp:Button ID="Button_New" runat="server" Text="新  增" CssClass="button" 
            onclick="Button_New_Click" UseSubmitBehavior="False" Visible="False" />
    <asp:Button ID="Button_Save" runat="server" Text="保  存" CssClass="button" 
                        onclick="Button_Save_Click" />
    <asp:Button ID="Button_Cancel" runat="server" Text="取  消" CssClass="button" onclick="Button_Cancel_Click" UseSubmitBehavior="False"  />
    <input ID="Back" type="button" value="返 回" onclick="document.location.href='BiaoShu_GL.aspx'" class="button" />
    </asp:Panel>   
    <asp:Panel ID="Panel2" runat="server" CssClass="panel" Visible="true">
        <table style="width: 100%">
            <tr>
                <td width=400>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                        UpdateCommand="Update [供应处合同旬计划] set [供应商ID]=@供应商ID,[年份]=@年份,[月份]=@月份,[旬]=@旬,[合同量]=@合同量 where ID=@ID"
                       
                        ></asp:SqlDataSource>
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                        DataSourceID="SqlDataSource1" Height="50px" Width="450px" 
                        DataKeyNames="ID" DefaultMode="Edit" GridLines="None">
                        <Fields>
                            <asp:BoundField DataField="ID" HeaderText="ID：" InsertVisible="False"  Visible="false"
                                ReadOnly="True" SortExpression="ID">
                                <HeaderStyle CssClass="detailheader" />
                            </asp:BoundField>                          
                            <asp:TemplateField HeaderText="单位名称：" SortExpression="单位名称">
                                <ItemTemplate>
                                    <asp:DropDownList ID="GongHuoDanWei" runat="server"  
                                        DataSourceID="SqlDataSource3" DataTextField="名称" DataValueField="ID"  Text='<%# Bind("供应商ID") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                                        SelectCommand="SELECT [ID], [名称], [联系人], [电话] FROM [原料供货单位]">
                                    </asp:SqlDataSource>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>                            
                           
                           <asp:TemplateField HeaderText="年份：" SortExpression="年份">
                                 <ItemTemplate>
                                     <asp:DropDownList ID="Year" runat="server" Text='<%# Bind("年份") %>'>
                                         <asp:ListItem>2009</asp:ListItem>
                                         <asp:ListItem>2010</asp:ListItem>
                                         <asp:ListItem>2011</asp:ListItem>
                                         <asp:ListItem>2012</asp:ListItem>
                                         <asp:ListItem>2013</asp:ListItem>
                                         <asp:ListItem>2014</asp:ListItem>
                                         <asp:ListItem>2015</asp:ListItem>
                                     </asp:DropDownList>
                                 </ItemTemplate>
                                  <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="月份：" SortExpression="月份" >
                                 <ItemTemplate>
                                     <asp:DropDownList ID="Month" runat="server" Text='<%# Bind("月份") %>'>  
                                         <asp:ListItem>1</asp:ListItem>
                                         <asp:ListItem>2</asp:ListItem>
                                         <asp:ListItem>3</asp:ListItem>
                                         <asp:ListItem>4</asp:ListItem>
                                         <asp:ListItem>5</asp:ListItem>
                                         <asp:ListItem>6</asp:ListItem>
                                         <asp:ListItem>7</asp:ListItem>
                                         <asp:ListItem>8</asp:ListItem>
                                         <asp:ListItem>9</asp:ListItem>
                                         <asp:ListItem>10</asp:ListItem>
                                         <asp:ListItem>11</asp:ListItem>
                                         <asp:ListItem>12</asp:ListItem>                                       
                                     </asp:DropDownList>
                                 </ItemTemplate>
                                  <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                           
                           <asp:TemplateField HeaderText="旬：" SortExpression="旬"  >
                                 <ItemTemplate>
                                     <asp:DropDownList ID="Xun" runat="server" Text='<%# Bind("旬") %>'>
                                         <asp:ListItem>上旬</asp:ListItem>
                                         <asp:ListItem>中旬</asp:ListItem>
                                         <asp:ListItem>下旬</asp:ListItem>
                                     </asp:DropDownList>
                                 </ItemTemplate>
                                  <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>       
                             <asp:TemplateField HeaderText="合同量：" SortExpression="合同量">
                                 <ItemTemplate>
                                     <asp:TextBox ID="HeTongLiang" runat="server" Text='<%# Bind("合同量") %>' onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false"></asp:TextBox>
                                 </ItemTemplate>
                                  <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>                          
                        </Fields>
                    </asp:DetailsView>
                </td>
                <td valign="top"><br />                    
                    <div class="prompt">
                    </div>
                </td>

            </tr>

        </table>

    </asp:Panel>
      <asp:Panel ID="Panel3" runat="server" CssClass="panel2" >
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#d0d0d0">
	            <tr>
		            <td class="grid-title">旬合同量管理</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            SelectCommand="select 供应处合同旬计划.ID,名称,年份,月份,旬,合同量 from 供应处合同旬计划 inner join 原料供货单位 on 供应处合同旬计划.供应商ID=原料供货单位.ID" 
                            >                         
                            </asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource2" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" 
                            CssClass="grid" GridLines="None" UseAccessibleHeader="False" 
                            AllowSorting="True">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                                    SortExpression="ID" ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header" 
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="60">
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Center" CssClass="grid" Width="60px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="名称" HeaderText="供货单位" SortExpression="名称" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="90" >
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Left" CssClass="grid" Width="90px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="年份" HeaderText="年份" SortExpression="年份" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="70" >
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Left" CssClass="grid" Width="70px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="月份" HeaderText="月份" SortExpression="月份" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="70">
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Left" CssClass="grid" Width="70px"></ItemStyle>
                                </asp:BoundField>
                                <asp:BoundField DataField="旬" HeaderText="旬" SortExpression="旬"  DataFormatString="{0:#,###.00}"  HtmlEncode="False"
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="90">
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Left" CssClass="grid" Width="90px"></ItemStyle>
                                </asp:BoundField>
                                 <asp:BoundField DataField="合同量" HeaderText="合同量" SortExpression="合同量" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="80">
<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Left" CssClass="grid" Width="80px"></ItemStyle>
                                </asp:BoundField>                              
                                <asp:TemplateField HeaderText="编辑操作" ShowHeader="true" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" 
                                    ItemStyle-Width="50" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>                                       
                                     <asp:Button ID="Button1" runat="server" CommandName='<%# Eval("ID") %>' 
                                            Text="编辑" onclick="Button1_Click" CssClass="smallbutton" />                                        
                                    </ItemTemplate>
<HeaderStyle CssClass="grid-header"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="grid" Width="50px"></ItemStyle>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="删除操作" ShowHeader="true" 
                                    ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" 
                                    ItemStyle-Width="50" ItemStyle-HorizontalAlign="Center">
                                     <ItemTemplate>                                       
                                        <asp:Button ID="Button2" runat="server" CommandName='<%# Eval("ID") %>' 
                                            Text="删除" onclick="Button2_Click" CssClass="smallbutton"  OnClientClick="if(!confirm('确认删除该条记录吗?')) return false;"/>
                                    </ItemTemplate>
<HeaderStyle CssClass="grid-header"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="grid" Width="50px"></ItemStyle>
                                    </asp:TemplateField>
                            </Columns>

                        </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server" Text="1"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }

    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
